import Vue from "vue";
import VueRouter from "vue-router";
import login from "../views/login.vue";
Vue.use(VueRouter);

const routes = [
  //登录
  {
    path: "/login",
    name: "login",
    component: login,
    meta: { isPublic: true },
    children: [],
  },
  //注册

  {
    path: "/register",
    name: "register",
    component: () => import("@/views/register.vue"),
  },
  {
    path: "/",
    name: "index",
    component: () => import("@/views/layout/index.vue"),
    children: [
      // 导航
      {
        path: "/home",
        name:"home",
        component: () => import("@/views/home/index.vue"),
      },
      //buycars
      {
        path: "/buycars",
        name:"buycars",
        component: () => import("@/views/buycars/BuyCars.vue"),
      },

      //sellcars
      {
        path: "/sellcars",
        component: () => import("@/views/sellcars/SellCars.vue"),
      },
      //forums
      {
        path: "/forums",
        component: () => import("@/views/forum/Forum.vue"),
      },
      {
        path: "/forums/detail/:id",
        name: "car-detail",
        props: true,
        component: () => import("../views/forum/ForumDetail.vue"),
      },
      {
        path: "/users/cars",
        component: () => import("@/views/users/MyCars.vue"),
      },
      
      {
        path: "/users/collects/:userid",
        component: () => import("@/views/users/MyCollects.vue"),
      },
      {
        path: "/users/infos/:userid",
        component: () => import("@/views/users/MyInfos.vue"),
      },

      {
        path: "/car/details/:id",
        name: "car-detail",
        props: true,
        component: () => import("../views/buycars/CarDetails.vue"),
      },
  
    ],

  },
];

const router = new VueRouter({
  routes,
});

export default router;
